from pydantic import BaseModel, ConfigDict
from typing import Optional, List
from uuid import UUID


class TaskCreate(BaseModel):
    platforms: List[str]
    keywords: Optional[List[str]] = None
    accounts: Optional[List[str]] = None
    time_start: Optional[str] = None
    time_end: Optional[str] = None
    scheduled_date: Optional[str] = None


class TaskRead(BaseModel):
    id: UUID
    task_id: str
    topic_code: str
    platform: str
    task_status: str
    scheduled_date: str
    total_crawled: int
    success_count: int
    error_count: int

    model_config = ConfigDict(from_attributes=True)


class TaskRunResult(BaseModel):
    task_id: str
    status: str
    total_crawled: int
    success_count: int
    error_count: int
